import React, { lazy } from 'react';
import { useRoutes, RouteObject } from 'react-router-dom';
import withRouter from './withRouter';
const KimiChat = lazy(() => import('@/pages/kimiChat/KimiChat'));
const KimiChatWebSocket = lazy(() => import('@/pages/kimiChatWebSocket/KimiChat'));
const KimiChatWebSocketAntd = lazy(() => import('@/pages/kimiChatWebSocketAntd/KimiChat'));
const KimiChatSseAntd = lazy(() => import('@/pages/kimiChatSseAntd/KimiChat'));
const KimiChatSseZhujuAntd = lazy(() => import('@/pages/kimiChatSseZhujuAntd/KimiChat'));
const KimiChatWebSocketAntd0910 = lazy(() => import('@/pages/kimiChatWebSocketAntd0910/KimiChat'));
const KimiChatWebSocketAntdSocketIO0910 = lazy(() => import('@/pages/kimiChatWebSocketAntdSocketIO0910/KimiChat'));
const KimiChatSocketIO = lazy(() => import('@/pages/kimiChatSocketIO/KimiChat'));
const KimiChatSocketIO0914 = lazy(() => import('@/pages/kimiChatSocketIO0914/KimiChat'));
export const routeConfig: RouteObject[] = [
    
    {
        path: '/kimi-chat',
        element: <KimiChat />,
    },
    {
        path: '/kimi-chat-WebSocket',
        element: <KimiChatWebSocket />,
    },
    {
        path: '/kimi-chat-WebSocket-antd',
        element: <KimiChatWebSocketAntd />,
    },
    {
        path: '/kimi-chat-sse-antd',
        element: <KimiChatSseAntd />,
    },
    {
        path: '/kimi-chat-sse-zhuju-antd',
        element: <KimiChatSseZhujuAntd />,
    },
    {
        path: '/kimi-chat-WebSocket-antd-0910',
        element: <KimiChatWebSocketAntd0910 />,
    },
    {
        path: '/kimi-chat-WebSocket-antd-socketIO-0910',
        element: <KimiChatWebSocketAntdSocketIO0910 />,
    },
    {
        path: '/kimi-chat-socketio',
        element: <KimiChatSocketIO />,
    },
    {
        path: '/kimi-chat-socketio-0914',
        element: <KimiChatSocketIO0914 />,
    },
];

export const RenderRouters = withRouter(({ config }: { config: RouteObject[] }) => {
    const element = useRoutes(config);

    return element;
});

export default RenderRouters;
